placesview: properly recover from cancellation
authorChristian Kellner <christian@kellner.me>
Sun, 4 Sep 2016 13:28:11 +0000 (15:28 +0200)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 9 Sep 2016 20:55:47 +0000 (16:55 -0400)
The current code wrongly assumes that cancellation can only happen
as a result widget finalization, and consequentially does not
properly recover from it. Therefore if the operation is cancelled
as a result of user interaction, the entry is will stay disabled
and the spinner will keep spinning. This is fixed by removal of
the early bail out in case of cancellation.

https://bugzilla.gnome.org/show_bug.cgi?id=764979

gtk/gtkplacesview.c

index 581c4ccd8e99ef7d48f76ef445cff8dc424ef55d..dd2b0197676eb9b307a1a247f32944b079788546 100644 (file)
@@ -1173,12 +1173,9 @@ server_mount_ready_cb (GObject      *source_file,
           emit_show_error_message (view, _("Unable to access location"), error->message);
           should_show = FALSE;
         }
-      else
-        {
-          /* it was cancelled, so probably it was called during finalize, bail out. */
-          g_clear_error (&error);
-          return;
-        }
+
+      /* The operation got cancelled by the user and or the error
+         has been handled already. */
       g_clear_error (&error);
     }
 
@@ -1247,13 +1244,9 @@ volume_mount_ready_cb (GObject      *source_volume,
           emit_show_error_message (GTK_PLACES_VIEW (user_data), _("Unable to access location"), error->message);
           should_show = FALSE;
         }
-      else
-        {
-          /* it was cancelled, so probably it was called during finalize, bail out. */
-          g_clear_error (&error);
-          return;
-        }
 
+      /* The operation got cancelled by the user and or the error
+         has been handled already. */
       g_clear_error (&error);
     }